package com.mjk.manager.api.constns;

import com.mjk.common.util.StrUtils;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 接口返回数据类型
 * @author msi
 *
 */
@Getter
public enum ApiReturnType {
	XMLDATA("3","以xml返回data部分"),
	JSONDATA("2","以json返回data部分"),
	NORMAL("1","正常返回");	
	private final String type;
	private final String remark;
	ApiReturnType(String type,String remark){
		this.remark = remark;
		this.type = type;
	}

	public static Map<String, String> toMap() {
		ApiReturnType[] ary = values();
		Map<String, String> enumMap = new HashMap<>();
        for (ApiReturnType apiReturnType : ary) {
            enumMap.put(apiReturnType.getType(), apiReturnType.getRemark());
        }
		return enumMap;
	}
	
	public static String getAllRole(){
		ApiReturnType[] ary = values();
		List<String> roles = new ArrayList<>();
        for (ApiReturnType apiReturnType : ary) {
            roles.add(apiReturnType.getType());
        }
		return StrUtils.join(roles, ",");
	}
}
